home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 11 / Info-Mac_XI_Disc_1.cdr_ / Info-Mac XI Disc 1.cdr / Programs / Science & Math / MacEspresso 1.0 / espresso / espresso.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-10  |  29.5 KB  |  788 lines  |  [TEXT/R*ch]

  1. /*
  2.  *  espresso.h -- header file for Espresso-mv
  3.  */
  4.  
  5. #include "port.h"
  6. #include "utility.h"
  7. #include "sparse.h"
  8. #include "mincov.h"
  9. #include <stdlib.h>
  10.  
  11. #define ptime()        util_cpu_time()
  12. #define print_time(t)    util_print_time(t)
  13.  
  14. //#undef NO_INLINE
  15. #define NO_INLINE
  16.  
  17. #ifdef IBM_WATC
  18. #define void int
  19. #include "short.h"
  20. #endif
  21.  
  22. #ifdef IBMPC        /* set default options for IBM/PC */
  23. #define NO_INLINE
  24. #define BPI 16
  25. #endif
  26.  
  27. /*-----THIS USED TO BE set.h----- */
  28.  
  29. /*
  30.  *  set.h -- definitions for packed arrays of bits
  31.  *
  32.  *   This header file describes the data structures which comprise a
  33.  *   facility for efficiently implementing packed arrays of bits
  34.  *   (otherwise known as sets, cf. Pascal).
  35.  *
  36.  *   A set is a vector of bits and is implemented here as an array of
  37.  *   unsigned integers.  The low order bits of set[0] give the index of
  38.  *   the last word of set data.  The higher order bits of set[0] are
  39.  *   used to store data associated with the set.  The set data is
  40.  *   contained in elements set[1] ... set[LOOP(set)] as a packed bit
  41.  *   array.
  42.  *
  43.  *   A family of sets is a two-dimensional matrix of bits and is
  44.  *   implemented with the data type "set_family".
  45.  *
  46.  *   BPI == 32 and BPI == 16 have been tested and work.
  47.  */
  48.  
  49.  
  50. /* Define host machine characteristics of "unsigned int" */
  51. #ifndef BPI
  52. #define BPI             32              /* # bits per integer */
  53. #endif
  54.  
  55. #if BPI == 32
  56. #define LOGBPI          5               /* log(BPI)/log(2) */
  57. #else
  58. #define LOGBPI          4               /* log(BPI)/log(2) */
  59. #endif
  60.  
  61. /* Define the set type */
  62. typedef unsigned int *pset;
  63.  
  64. /* Define the set family type -- an array of sets */
  65. typedef struct set_family {
  66.     int wsize;                  /* Size of each set in 'ints' */
  67.     int sf_size;                /* User declared set size */
  68.     int capacity;               /* Number of sets allocated */
  69.     int count;                  /* The number of sets in the family */
  70.     int active_count;           /* Number of "active" sets */
  71.     pset data;                  /* Pointer to the set data */
  72.     struct set_family *next;    /* For garbage collection */
  73. } set_family_t, *pset_family;
  74.  
  75. /* Macros to set and test single elements */
  76. #define WHICH_WORD(element)     (((element) >> LOGBPI) + 1)
  77. #define WHICH_BIT(element)      ((element) & (BPI-1))
  78.  
  79. /* # of ints needed to allocate a set with "size" elements */
  80. #if BPI == 32
  81. #define SET_SIZE(size)          ((size) <= BPI ? 2 : (WHICH_WORD((size)-1) + 1))
  82. #else
  83. #define SET_SIZE(size)          ((size) <= BPI ? 3 : (WHICH_WORD((size)-1) + 2))
  84. #endif
  85.  
  86. /*
  87.  *  Three fields are maintained in the first word of the set
  88.  *      LOOP is the index of the last word used for set data
  89.  *      LOOPCOPY is the index of the last word in the set
  90.  *      SIZE is available for general use (e.g., recording # elements in set)
  91.  *      NELEM retrieves the number of elements in the set
  92.  */
  93. #define LOOP(set)               (set[0] & 0x03ff)
  94. #define PUTLOOP(set, i)         (set[0] &= ~0x03ff, set[0] |= (i))
  95. #if BPI == 32
  96. #define LOOPCOPY(set)           LOOP(set)
  97. #define SIZE(set)               (set[0] >> 16)
  98. #define PUTSIZE(set, size)      (set[0] &= 0xffff, set[0] |= ((size) << 16))
  99. #else
  100. #define LOOPCOPY(set)           (LOOP(set) + 1)
  101. #define SIZE(set)               (set[LOOP(set)+1])
  102. #define PUTSIZE(set, size)      ((set[LOOP(set)+1]) = (size))
  103. #endif
  104.  
  105. #define NELEM(set)        (BPI * LOOP(set))
  106. #define LOOPINIT(size)        ((size <= BPI) ? 1 : WHICH_WORD((size)-1))
  107.  
  108. /*
  109.  *      FLAGS store general information about the set
  110.  */
  111. #define SET(set, flag)          (set[0] |= (flag))
  112. #define RESET(set, flag)        (set[0] &= ~ (flag))
  113. #define TESTP(set, flag)        (set[0] & (flag))
  114.  
  115. /* Flag definitions are ... */
  116. #define PRIME           0x8000          /* cube is prime */
  117. #define NONESSEN        0x4000          /* cube cannot be essential prime */
  118. #define ACTIVE          0x2000          /* cube is still active */
  119. #define REDUND          0x1000          /* cube is redundant(at this point) */
  120. #define COVERED         0x0800          /* cube has been covered */
  121. #define RELESSEN        0x0400          /* cube is relatively essential */
  122.  
  123. /* Most efficient way to look at all members of a set family */
  124. #define foreach_set(R, last, p)\
  125.     for(p=R->data,last=p+R->count*R->wsize;p<last;p+=R->wsize)
  126. #define foreach_remaining_set(R, last, pfirst, p)\
  127.     for(p=pfirst+R->wsize,last=R->data+R->count*R->wsize;p<last;p+=R->wsize)
  128. #define foreach_active_set(R, last, p)\
  129.     foreach_set(R,last,p) if (TESTP(p, ACTIVE))
  130.  
  131. /* Another way that also keeps the index of the current set member in i */
  132. #define foreachi_set(R, i, p)\
  133.     for(p=R->data,i=0;i<R->count;p+=R->wsize,i++)
  134. #define foreachi_active_set(R, i, p)\
  135.     foreachi_set(R,i,p) if (TESTP(p, ACTIVE))
  136.  
  137. /* Looping over all elements in a set:
  138.  *      foreach_set_element(pset p, int i, unsigned val, int base) {
  139.  *        .
  140.  *        .
  141.  *        .
  142.  *      }
  143.  */
  144. #define foreach_set_element(p, i, val, base)         \
  145.     for(i = LOOP(p); i > 0; )                \
  146.     for(val = p[i], base = --i << LOGBPI; val != 0; base++, val >>= 1)  \
  147.         if (val & 1)
  148.  
  149. /* Return a pointer to a given member of a set family */
  150. #define GETSET(family, index)   ((family)->data + (family)->wsize * (index))
  151.  
  152. /* Allocate and deallocate sets */
  153. #define set_new(size)    set_clear(ALLOC(unsigned int, SET_SIZE(size)), size)
  154. #define set_full(size)    set_fill(ALLOC(unsigned int, SET_SIZE(size)), size)
  155. #define set_save(r)    set_copy(ALLOC(unsigned int, SET_SIZE(NELEM(r))), r)
  156. #define set_free(r)    FREE(r)
  157.  
  158. /* Check for set membership, remove set element and insert set element */
  159. #define is_in_set(set, e)       (set[WHICH_WORD(e)] & (1 << WHICH_BIT(e)))
  160. #define set_remove(set, e)      (set[WHICH_WORD(e)] &= ~ (1 << WHICH_BIT(e)))
  161. #define set_insert(set, e)      (set[WHICH_WORD(e)] |= 1 << WHICH_BIT(e))
  162.  
  163. /* Inline code substitution for those places that REALLY need it on a VAX */
  164. #ifdef NO_INLINE
  165. #define INLINEset_copy(r, a)        (void) set_copy(r,a)
  166. #define INLINEset_clear(r, size)    (void) set_clear(r, size)
  167. #define INLINEset_fill(r, size)        (void) set_fill(r, size)
  168. #define INLINEset_and(r, a, b)        (void) set_and(r, a, b)
  169. #define INLINEset_or(r, a, b)        (void) set_or(r, a, b)
  170. #define INLINEset_diff(r, a, b)        (void) set_diff(r, a, b)
  171. #define INLINEset_ndiff(r, a, b, f)    (void) set_ndiff(r, a, b, f)
  172. #define INLINEset_xor(r, a, b)        (void) set_xor(r, a, b)
  173. #define INLINEset_xnor(r, a, b, f)    (void) set_xnor(r, a, b, f)
  174. #define INLINEset_merge(r, a, b, mask)    (void) set_merge(r, a, b, mask)
  175. #define INLINEsetp_implies(a, b, when_false)    \
  176.     if (! setp_implies(a,b)) when_false
  177. #define INLINEsetp_disjoint(a, b, when_false)    \
  178.     if (! setp_disjoint(a,b)) when_false
  179. #define INLINEsetp_equal(a, b, when_false)    \
  180.     if (! setp_equal(a,b)) when_false
  181.  
  182. #else
  183.  
  184. #define INLINEset_copy(r, a)\
  185.     {register int i_=LOOPCOPY(a); do r[i_]=a[i_]; while (--i_>=0);}
  186. #define INLINEset_clear(r, size)\
  187.     {register int i_=LOOPINIT(size); *r=i_; do r[i_] = 0; while (--i_ > 0);}
  188. #define INLINEset_fill(r, size)\
  189.     {register int i_=LOOPINIT(size); *r=i_; \
  190.     r[i_]=((unsigned int)(~0))>>(i_*BPI-size); while(--i_>0) r[i_]=~0;}
  191. #define INLINEset_and(r, a, b)\
  192.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  193.     do r[i_] = a[i_] & b[i_]; while (--i_>0);}
  194. #define INLINEset_or(r, a, b)\
  195.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  196.     do r[i_] = a[i_] | b[i_]; while (--i_>0);}
  197. #define INLINEset_diff(r, a, b)\
  198.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  199.     do r[i_] = a[i_] & ~ b[i_]; while (--i_>0);}
  200. #define INLINEset_ndiff(r, a, b, fullset)\
  201.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  202.     do r[i_] = fullset[i_] & (a[i_] | ~ b[i_]); while (--i_>0);}
  203. #ifdef IBM_WATC
  204. #define INLINEset_xor(r, a, b)        (void) set_xor(r, a, b)
  205. #define INLINEset_xnor(r, a, b, f)    (void) set_xnor(r, a, b, f)
  206. #else
  207. #define INLINEset_xor(r, a, b)\
  208.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  209.     do r[i_] = a[i_] ^ b[i_]; while (--i_>0);}
  210. #define INLINEset_xnor(r, a, b, fullset)\
  211.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  212.     do r[i_] = fullset[i_] & ~ (a[i_] ^ b[i_]); while (--i_>0);}
  213. #endif
  214. #define INLINEset_merge(r, a, b, mask)\
  215.     {register int i_=LOOP(a); PUTLOOP(r,i_);\
  216.     do r[i_] = (a[i_]&mask[i_]) | (b[i_]&~mask[i_]); while (--i_>0);}
  217. #define INLINEsetp_implies(a, b, when_false)\
  218.     {register int i_=LOOP(a); do if (a[i_]&~b[i_]) break; while (--i_>0);\
  219.     if (i_ != 0) when_false;}
  220. #define INLINEsetp_disjoint(a, b, when_false)\
  221.     {register int i_=LOOP(a); do if (a[i_]&b[i_]) break; while (--i_>0);\
  222.     if (i_ != 0) when_false;}
  223. #define INLINEsetp_equal(a, b, when_false)\
  224.     {register int i_=LOOP(a); do if (a[i_]!=b[i_]) break; while (--i_>0);\
  225.     if (i_ != 0) when_false;}
  226.  
  227. #endif
  228.  
  229. #if BPI == 32
  230. #define count_ones(v)\
  231.     (bit_count[v & 255] + bit_count[(v >> 8) & 255]\
  232.     + bit_count[(v >> 16) & 255] + bit_count[(v >> 24) & 255])
  233. #else
  234. #define count_ones(v)   (bit_count[v & 255] + bit_count[(v >> 8) & 255])
  235. #endif
  236.  
  237. /* Table for efficient bit counting */
  238. extern int bit_count[256];
  239. /*----- END OF set.h ----- */
  240.  
  241. /* Define a boolean type */
  242. #define bool    int
  243. //#define FALSE    0
  244. //#define TRUE     1
  245. #define MAYBE    2
  246. #define print_bool(x) ((x) == 0 ? "FALSE" : ((x) == 1 ? "TRUE" : "MAYBE"))
  247.  
  248. /* Map many cube/cover types/routines into equivalent set types/routines */
  249. #define pcube                   pset
  250. #define new_cube()              set_new(cube.size)
  251. #define free_cube(r)            set_free(r)
  252. #define pcover                  pset_family
  253. #define new_cover(i)            sf_new(i, cube.size)
  254. #define free_cover(r)           sf_free(r)
  255. #define free_cubelist(T)        FREE(T[0]); FREE(T);
  256.  
  257.  
  258. /* cost_t describes the cost of a cover */
  259. typedef struct cost_struct {
  260.     int cubes;            /* number of cubes in the cover */
  261.     int in;            /* transistor count, binary-valued variables */
  262.     int out;            /* transistor count, output part */
  263.     int mv;            /* transistor count, multiple-valued vars */
  264.     int total;            /* total number of transistors */
  265.     int primes;            /* number of prime cubes */
  266. } cost_t, *pcost;
  267.  
  268.  
  269. /* pair_t describes bit-paired variables */
  270. typedef struct pair_struct {
  271.     int cnt;
  272.     int *var1;
  273.     int *var2;
  274. } pair_t, *ppair;
  275.  
  276.  
  277. /* symbolic_list_t describes a single ".symbolic" line */
  278. typedef struct symbolic_list_struct {
  279.     int variable;
  280.     int pos;
  281.     struct symbolic_list_struct *next;
  282. } symbolic_list_t;
  283.  
  284.  
  285. /* symbolic_list_t describes a single ".symbolic" line */
  286. typedef struct symbolic_label_struct {
  287.     char *label;
  288.     struct symbolic_label_struct *next;
  289. } symbolic_label_t;
  290.  
  291.  
  292. /* symbolic_t describes a linked list of ".symbolic" lines */
  293. typedef struct symbolic_struct {
  294.     symbolic_list_t *symbolic_list;    /* linked list of items */
  295.     int symbolic_list_length;        /* length of symbolic_list list */
  296.     symbolic_label_t *symbolic_label;    /* linked list of new names */
  297.     int symbolic_label_length;        /* length of symbolic_label list */
  298.     struct symbolic_struct *next;
  299. } symbolic_t;
  300.  
  301.  
  302. /* PLA_t stores the logical representation of a PLA */
  303. typedef struct {
  304.     pcover F, D, R;        /* on-set, off-set and dc-set */
  305.     char *filename;             /* filename */
  306.     int pla_type;               /* logical PLA format */
  307.     pcube phase;                /* phase to split into on-set and off-set */
  308.     ppair pair;                 /* how to pair variables */
  309.     char **label;        /* labels for the columns */
  310.     symbolic_t *symbolic;    /* allow binary->symbolic mapping */
  311.     symbolic_t *symbolic_output;/* allow symbolic output mapping */
  312. } PLA_t, *pPLA;
  313.  
  314. #define equal(a,b)      (strcmp(a,b) == 0)
  315.  
  316. /* This is a hack which I wish I hadn't done, but too painful to change */
  317. #define CUBELISTSIZE(T)         (((pcube *) T[1] - T) - 3)
  318.  
  319. /* For documentation purposes */
  320. #define IN
  321. #define OUT
  322. #define INOUT
  323.  
  324. /* The pla_type field describes the input and output format of the PLA */
  325. #define F_type          1
  326. #define D_type          2
  327. #define R_type          4
  328. #define PLEASURE_type   8               /* output format */
  329. #define EQNTOTT_type    16              /* output format algebraic eqns */
  330. #define KISS_type    128        /* output format kiss */
  331. #define CONSTRAINTS_type    256    /* output the constraints (numeric) */
  332. #define SYMBOLIC_CONSTRAINTS_type 512    /* output the constraints (symbolic) */
  333. #define FD_type (F_type | D_type)
  334. #define FR_type (F_type | R_type)
  335. #define DR_type (D_type | R_type)
  336. #define FDR_type (F_type | D_type | R_type)
  337.  
  338. /* Definitions for the debug variable */
  339. #define COMPL           0x0001
  340. #define ESSEN           0x0002
  341. #define EXPAND          0x0004
  342. #define EXPAND1         0x0008
  343. #define GASP            0x0010
  344. #define IRRED           0x0020
  345. #define REDUCE          0x0040
  346. #define REDUCE1         0x0080
  347. #define SPARSE          0x0100
  348. #define TAUT            0x0200
  349. #define EXACT           0x0400
  350. #define MINCOV          0x0800
  351. #define MINCOV1         0x1000
  352. #define SHARP           0x2000
  353. #define IRRED1        0x4000
  354.  
  355. #define VERSION\
  356.     "UC Berkeley, Espresso Version #2.3, Release date 01/31/88\nMac port by Mikhail Fridberg, fridberg@pfc.mit.edu"
  357.  
  358. /* Define constants used for recording program statistics */
  359. #define TIME_COUNT      22
  360. #define READ_TIME       0
  361. #define COMPL_TIME      1
  362. #define ONSET_TIME    2
  363. #define ESSEN_TIME      3
  364. #define EXPAND_TIME     4
  365. #define IRRED_TIME      5
  366. #define REDUCE_TIME     6
  367. #define GEXPAND_TIME    7
  368. #define GIRRED_TIME     8
  369. #define GREDUCE_TIME    9
  370. #define PRIMES_TIME     10
  371. #define MINCOV_TIME    11
  372. #define MV_REDUCE_TIME  12
  373. #define RAISE_IN_TIME   13
  374. #define VERIFY_TIME     14
  375. #define WRITE_TIME    15
  376. #define FCC_TIME    16
  377. #define ETR_TIME    17
  378. #define ETRAUX_TIME    18
  379. #define SIGMA_TIME    19
  380. #define UCOMP_TIME    20
  381. #define BW_TIME        21
  382.  
  383. /* For those who like to think about PLAs, macros to get at inputs/outputs */
  384. #define NUMINPUTS       cube.num_binary_vars
  385. #define NUMOUTPUTS      cube.part_size[cube.num_vars - 1]
  386.  
  387. #define POSITIVE_PHASE(pos)\
  388.     (is_in_set(PLA->phase, cube.first_part[cube.output]+pos) != 0)
  389.  
  390. #define INLABEL(var)    PLA->label[cube.first_part[var] + 1]
  391. #define OUTLABEL(pos)   PLA->label[cube.first_part[cube.output] + pos]
  392.  
  393. #define GETINPUT(c, pos)\
  394.     ((c[WHICH_WORD(2*pos)] >> WHICH_BIT(2*pos)) & 3)
  395. #define GETOUTPUT(c, pos)\
  396.     (is_in_set(c, cube.first_part[cube.output] + pos) != 0)
  397.  
  398. #define PUTINPUT(c, pos, value)\
  399.     c[WHICH_WORD(2*pos)] = (c[WHICH_WORD(2*pos)] & ~(3 << WHICH_BIT(2*pos)))\
  400.         | (value << WHICH_BIT(2*pos))
  401. #define PUTOUTPUT(c, pos, value)\
  402.     c[WHICH_WORD(pos)] = (c[WHICH_WORD(pos)] & (1 << WHICH_BIT(pos)))\
  403.         | (value << WHICH_BIT(pos))
  404.  
  405. #define TWO     3
  406. #define DASH    3
  407. #define ONE     2
  408. #define ZERO    1
  409.  
  410.  
  411. #define EXEC(fct, name, S)\
  412.     {long t=ptime();fct;if(trace)print_trace(S,name,ptime()-t);}
  413. #define EXEC_S(fct, name, S)\
  414.     {long t=ptime();fct;if(summary)print_trace(S,name,ptime()-t);}
  415. #define EXECUTE(fct,i,S,cost)\
  416.     {long t=ptime();fct;totals(t,i,S,&(cost));}
  417. /* lightweight EXECUTE */
  418. #define S_EXECUTE(fct,i)\
  419.     {long t=ptime();fct;s_totals(t,i);}
  420.  
  421. /*
  422.  *    Global Variable Declarations
  423.  */
  424.  
  425. extern unsigned int debug;              /* debug parameter */
  426. extern bool verbose_debug;              /* -v:  whether to print a lot */
  427. extern char *total_name[TIME_COUNT];    /* basic function names */
  428. extern long total_time[TIME_COUNT];     /* time spent in basic fcts */
  429. extern int total_calls[TIME_COUNT];     /* # calls to each fct */
  430.  
  431. extern bool echo_comments;        /* turned off by -eat option */
  432. extern bool echo_unknown_commands;    /* always true ?? */
  433. extern bool force_irredundant;          /* -nirr command line option */
  434. extern bool skip_make_sparse;
  435. extern bool kiss;                       /* -kiss command line option */
  436. extern bool pos;                        /* -pos command line option */
  437. extern bool print_solution;             /* -x command line option */
  438. extern bool recompute_onset;            /* -onset command line option */
  439. extern bool remove_essential;           /* -ness command line option */
  440. extern bool single_expand;              /* -fast command line option */
  441. extern bool summary;                    /* -s command line option */
  442. extern bool trace;                      /* -t command line option */
  443. extern bool unwrap_onset;               /* -nunwrap command line option */
  444. extern bool use_random_order;        /* -random command line option */
  445. extern bool use_super_gasp;        /* -strong command line option */
  446. extern char *filename;            /* filename PLA was read from */
  447. extern bool debug_exact_minimization;   /* dumps info for -do exact */
  448.  
  449.  
  450. /*
  451.  *  pla_types are the input and output types for reading/writing a PLA
  452.  */
  453. struct pla_types_struct {
  454.     char *key;
  455.     int value;
  456. };
  457.  
  458.  
  459. /*
  460.  *  The cube structure is a global structure which contains information
  461.  *  on how a set maps into a cube -- i.e., number of parts per variable,
  462.  *  number of variables, etc.  Also, many fields are pre-computed to
  463.  *  speed up various primitive operations.
  464.  */
  465. #define CUBE_TEMP       10
  466.  
  467. struct cube_struct {
  468.     int size;                   /* set size of a cube */
  469.     int num_vars;               /* number of variables in a cube */
  470.     int num_binary_vars;        /* number of binary variables */
  471.     int *first_part;            /* first element of each variable */
  472.     int *last_part;             /* first element of each variable */
  473.     int *part_size;             /* number of elements in each variable */
  474.     int *first_word;            /* first word for each variable */
  475.     int *last_word;             /* last word for each variable */
  476.     pset binary_mask;           /* Mask to extract binary variables */
  477.     pset mv_mask;               /* mask to get mv parts */
  478.     pset *var_mask;             /* mask to extract a variable */
  479.     pset *temp;                 /* an array of temporary sets */
  480.     pset fullset;               /* a full cube */
  481.     pset emptyset;              /* an empty cube */
  482.     unsigned int inmask;        /* mask to get odd word of binary part */
  483.     int inword;                 /* which word number for above */
  484.     int *sparse;                /* should this variable be sparse? */
  485.     int num_mv_vars;            /* number of multiple-valued variables */
  486.     int output;                 /* which variable is "output" (-1 if none) */
  487. };
  488.  
  489. struct cdata_struct {
  490.     int *part_zeros;            /* count of zeros for each element */
  491.     int *var_zeros;             /* count of zeros for each variable */
  492.     int *parts_active;          /* number of "active" parts for each var */
  493.     bool *is_unate;             /* indicates given var is unate */
  494.     int vars_active;            /* number of "active" variables */
  495.     int vars_unate;             /* number of unate variables */
  496.     int best;                   /* best "binate" variable */
  497. };
  498.  
  499.  
  500. extern struct pla_types_struct pla_types[];
  501. extern struct cube_struct cube, temp_cube_save;
  502. extern struct cdata_struct cdata, temp_cdata_save;
  503.  
  504. #ifdef lint
  505. #define DISJOINT 0x5555
  506. #else
  507. #if BPI == 32
  508. #define DISJOINT 0x55555555
  509. #else
  510. #define DISJOINT 0x5555
  511. #endif
  512. #endif
  513.  
  514. /* function declarations */
  515.  
  516. /* cofactor.c */    extern int binate_split_select();
  517. /* cofactor.c */    extern pcover cubeunlist();
  518. /* cofactor.c */    extern pcube *cofactor();
  519. /* cofactor.c */    extern pcube *cube1list();
  520. /* cofactor.c */    extern pcube *cube2list();
  521. /* cofactor.c */    extern pcube *cube3list();
  522. /* cofactor.c */    extern pcube *scofactor();
  523. /* cofactor.c */    extern void massive_count();
  524. /* cofactor.c */    extern void simplify_cubelist(pcube *T);
  525. /* compl.c */    extern pcover complement();
  526. /* compl.c */    extern pcover simplify();
  527. /* compl.c */    extern void simp_comp();
  528. /* contain.c */    extern int d1_rm_equal();
  529. /* contain.c */    extern int rm2_contain();
  530. /* contain.c */    extern int rm2_equal();
  531. /* contain.c */    extern int rm_contain();
  532. /* contain.c */    extern int rm_equal();
  533. /* contain.c */    extern int rm_rev_contain();
  534. /* contain.c */    extern pset *sf_list();
  535. /* contain.c */    extern pset *sf_sort();
  536. /* contain.c */    extern pset_family d1merge();
  537. /* contain.c */    extern pset_family dist_merge();
  538. /* contain.c */    extern pset_family sf_contain();
  539. /* contain.c */    extern pset_family sf_dupl();
  540. /* contain.c */    extern pset_family sf_ind_contain();
  541. /* contain.c */    extern pset_family sf_ind_unlist();
  542. /* contain.c */    extern pset_family sf_merge();
  543. /* contain.c */    extern pset_family sf_rev_contain();
  544. /* contain.c */    extern pset_family sf_union();
  545. /* contain.c */    extern pset_family sf_unlist();
  546. /* cubestr.c */    extern void cube_setup();
  547. /* cubestr.c */    extern void restore_cube_struct();
  548. /* cubestr.c */    extern void save_cube_struct();
  549. /* cubestr.c */    extern void setdown_cube();
  550. /* cvrin.c */    extern PLA_labels();
  551. /* cvrin.c */    extern char *get_word();
  552. /* cvrin.c */    extern int label_index();
  553. /* cvrin.c */    extern int read_pla();
  554. /* cvrin.c */    extern int read_symbolic();
  555. /* cvrin.c */    extern pPLA new_PLA();
  556. /* cvrin.c */    extern void PLA_summary();
  557. /* cvrin.c */    extern void free_PLA();
  558. /* cvrin.c */    extern void parse_pla();
  559. /* cvrin.c */    extern void read_cube();
  560. /* cvrin.c */    extern void skip_line();
  561. /* cvrm.c */    extern foreach_output_function();
  562. /* cvrm.c */    extern int cubelist_partition();
  563. /* cvrm.c */    extern int so_both_do_espresso();
  564. /* cvrm.c */    extern int so_both_do_exact();
  565. /* cvrm.c */    extern int so_both_save();
  566. /* cvrm.c */    extern int so_do_espresso();
  567. /* cvrm.c */    extern int so_do_exact();
  568. /* cvrm.c */    extern int so_save();
  569. /* cvrm.c */    extern pcover cof_output();
  570. /* cvrm.c */    extern pcover lex_sort();
  571. /* cvrm.c */    extern pcover mini_sort();
  572. /* cvrm.c */    extern pcover random_order();
  573. /* cvrm.c */    extern pcover size_sort();
  574. /* cvrm.c */    extern pcover sort_reduce();
  575. /* cvrm.c */    extern pcover uncof_output();
  576. /* cvrm.c */    extern pcover unravel();
  577. /* cvrm.c */    extern pcover unravel_range();
  578. /* cvrm.c */    extern void so_both_espresso();
  579. /* cvrm.c */    extern void so_espresso();
  580. /* cvrmisc.c */    extern char *fmt_cost();
  581. /* cvrmisc.c */    extern char *print_cost();
  582. /* cvrmisc.c */    extern char *strsav();
  583. /* cvrmisc.c */    extern void copy_cost();
  584. /* cvrmisc.c */    extern void cover_cost();
  585. /* cvrmisc.c */    extern void fatal();
  586. /* cvrmisc.c */    extern void print_trace();
  587. /* cvrmisc.c */    extern void size_stamp();
  588. /* cvrmisc.c */    extern void totals();
  589. /* cvrout.c */    extern char *fmt_cube();
  590. /* cvrout.c */    extern char *fmt_expanded_cube();
  591. /* cvrout.c */    extern char *pc1();
  592. /* cvrout.c */    extern char *pc2();
  593. /* cvrout.c */    extern char *pc3();
  594. /* cvrout.c */    extern int makeup_labels();
  595. /* cvrout.c */    extern kiss_output();
  596. /* cvrout.c */    extern kiss_print_cube();
  597. /* cvrout.c */    extern output_symbolic_constraints();
  598. /* cvrout.c */    extern void cprint();
  599. /* cvrout.c */    extern void debug1_print();
  600. /* cvrout.c */    extern void debug_print();
  601. /* cvrout.c */    extern void eqn_output();
  602. /* cvrout.c */    extern void fpr_header();
  603. /* cvrout.c */    extern void fprint_pla();
  604. /* cvrout.c */    extern void pls_group();
  605. /* cvrout.c */    extern void pls_label();
  606. /* cvrout.c */    extern void pls_output();
  607. /* cvrout.c */    extern void print_cube();
  608. /* cvrout.c */    extern void print_expanded_cube();
  609. /* cvrout.c */    extern void sf_debug_print();
  610. /* equiv.c */    extern find_equiv_outputs();
  611. /* equiv.c */    extern int check_equiv();
  612. /* espresso.c*/    extern pcover espresso();
  613. /* essen.c */    extern bool essen_cube();
  614. /* essen.c */    extern pcover cb_consensus();
  615. /* essen.c */    extern pcover cb_consensus_dist0();
  616. /* essen.c */    extern pcover essential();
  617. /* essen.c */    extern int pop_black_list(void);
  618. /* exact.c */    extern pcover minimize_exact();
  619. /* exact.c */    extern pcover minimize_exact_literals();
  620. /* expand.c */    extern bool feasibly_covered();
  621. /* expand.c */    extern int most_frequent();
  622. /* expand.c */    extern pcover all_primes();
  623. /* expand.c */    extern pcover expand();
  624. /* expand.c */    extern pcover find_all_primes();
  625. /* expand.c */    extern void elim_lowering();
  626. /* expand.c */    extern void essen_parts();
  627. /* expand.c */    extern void essen_raising();
  628. /* expand.c */    extern void expand1();
  629. /* expand.c */    extern void mincov();
  630. /* expand.c */    extern void select_feasible();
  631. /* expand.c */    extern void setup_BB_CC();
  632. /* gasp.c */    extern pcover expand_gasp();
  633. /* gasp.c */    extern pcover irred_gasp();
  634. /* gasp.c */    extern pcover last_gasp();
  635. /* gasp.c */    extern pcover super_gasp();
  636. /* gasp.c */    extern void expand1_gasp();
  637. /* getopt.c */    extern int getopt();
  638. /* hack.c */    extern find_dc_inputs();
  639. /* hack.c */    extern find_inputs();
  640. /* hack.c */    extern form_bitvector();
  641. /* hack.c */    extern map_dcset();
  642. /* hack.c */    extern map_output_symbolic();
  643. /* hack.c */    extern map_symbolic();
  644. /* hack.c */    extern pcover map_symbolic_cover();
  645. /* hack.c */    extern symbolic_hack_labels();
  646. /* hack.c */    extern void disassemble_fsm(pPLA PLA, int verbose_mode);
  647. /* irred.c */    extern bool cube_is_covered();
  648. /* irred.c */    extern bool taut_special_cases();
  649. /* irred.c */    extern bool tautology();
  650. /* irred.c */    extern pcover irredundant();
  651. /* irred.c */    extern void mark_irredundant();
  652. /* irred.c */    extern void irred_split_cover();
  653. /* irred.c */    extern sm_matrix *irred_derive_table();
  654. /* map.c */    extern pset minterms();
  655. /* map.c */    extern void explode();
  656. /* map.c */    extern void map();
  657. /* opo.c */    extern output_phase_setup();
  658. /* opo.c */    extern pPLA set_phase();
  659. /* opo.c */    extern pcover opo();
  660. /* opo.c */    extern pcube find_phase();
  661. /* opo.c */    extern pset_family find_covers();
  662. /* opo.c */    extern pset_family form_cover_table();
  663. /* opo.c */    extern pset_family opo_leaf();
  664. /* opo.c */    extern pset_family opo_recur();
  665. /* opo.c */    extern void opoall();
  666. /* opo.c */    extern void phase_assignment();
  667. /* opo.c */    extern void repeated_phase_assignment();
  668. /* pair.c */    extern generate_all_pairs();
  669. /* pair.c */    extern int **find_pairing_cost();
  670. /* pair.c */    extern int find_best_cost();
  671. /* pair.c */    extern int greedy_best_cost();
  672. /* pair.c */    extern int minimize_pair();
  673. /* pair.c */    extern int pair_free();
  674. /* pair.c */    extern pair_all();
  675. /* pair.c */    extern pcover delvar();
  676. /* pair.c */    extern pcover pairvar();
  677. /* pair.c */    extern ppair pair_best_cost();
  678. /* pair.c */    extern ppair pair_new();
  679. /* pair.c */    extern ppair pair_save();
  680. /* pair.c */    extern print_pair();
  681. /* pair.c */    extern void find_optimal_pairing();
  682. /* pair.c */    extern void set_pair();
  683. /* pair.c */    extern void set_pair1();
  684. /* primes.c */    extern pcover primes_consensus();
  685. /* reduce.c */    extern bool sccc_special_cases();
  686. /* reduce.c */    extern pcover reduce();
  687. /* reduce.c */    extern pcube reduce_cube();
  688. /* reduce.c */    extern pcube sccc();
  689. /* reduce.c */    extern pcube sccc_cube();
  690. /* reduce.c */    extern pcube sccc_merge();
  691. /* set.c */    extern bool set_andp();
  692. /* set.c */    extern bool set_orp();
  693. /* set.c */    extern bool setp_disjoint();
  694. /* set.c */    extern bool setp_empty();
  695. /* set.c */    extern bool setp_equal();
  696. /* set.c */    extern bool setp_full();
  697. /* set.c */    extern bool setp_implies(register pset a,register pset b);
  698. /* set.c */    extern char *pbv1();
  699. /* set.c */    extern char *ps1();
  700. /* set.c */    extern int *sf_count();
  701. /* set.c */    extern int *sf_count_restricted();
  702. /* set.c */    extern int bit_index();
  703. /* set.c */    extern int set_dist();
  704. /* set.c */    extern int set_ord();
  705. /* set.c */    extern void set_adjcnt();
  706. /* set.c */    extern pset set_and();
  707. /* set.c */    extern pset set_clear();
  708. /* set.c */    extern pset set_copy();
  709. /* set.c */    extern pset set_diff();
  710. /* set.c */    extern pset set_fill();
  711. /* set.c */    extern pset set_merge();
  712. /* set.c */    extern pset set_or();
  713. /* set.c */    extern pset set_xor();
  714. /* set.c */    extern pset sf_and();
  715. /* set.c */    extern pset sf_or();
  716. /* set.c */    extern pset_family sf_active();
  717. /* set.c */    extern pset_family sf_addcol();
  718. /* set.c */    extern pset_family sf_addset();
  719. /* set.c */    extern pset_family sf_append();
  720. /* set.c */    extern pset_family sf_bm_read();
  721. /* set.c */    extern pset_family sf_compress();
  722. /* set.c */    extern pset_family sf_copy();
  723. /* set.c */    extern pset_family sf_copy_col();
  724. /* set.c */    extern pset_family sf_delc();
  725. /* set.c */    extern pset_family sf_delcol();
  726. /* set.c */    extern pset_family sf_inactive();
  727. /* set.c */    extern pset_family sf_join();
  728. /* set.c */    extern pset_family sf_new();
  729. /* set.c */    extern pset_family sf_permute();
  730. /* set.c */    extern pset_family sf_read();
  731. /* set.c */    extern pset_family sf_save();
  732. /* set.c */    extern pset_family sf_transpose();
  733. /* set.c */    extern void set_write();
  734. /* set.c */    extern void sf_bm_print();
  735. /* set.c */    extern void sf_cleanup();
  736. /* set.c */    extern void sf_delset();
  737. /* set.c */    extern void sf_free();
  738. /* set.c */    extern void sf_print();
  739. /* set.c */    extern void sf_write();
  740. /* setc.c */    extern bool ccommon();
  741. /* setc.c */    extern bool cdist0();
  742. /* setc.c */    extern bool full_row();
  743. /* setc.c */    extern int ascend();
  744. /* setc.c */    extern int cactive();
  745. /* setc.c */    extern int cdist();
  746. /* setc.c */    extern int cdist01();
  747. /* setc.c */    extern int cvolume();
  748. /* setc.c */    extern int d1_order();
  749. /* setc.c */    extern int d1_order_size();
  750. /* setc.c */    extern int desc1();
  751. /* setc.c */    extern int descend();
  752. /* setc.c */    extern int lex_order();
  753. /* setc.c */    extern int lex_order1();
  754. /* setc.c */    extern pset force_lower();
  755. /* setc.c */    extern void consensus();
  756. /* sharp.c */    extern pcover cb1_dsharp();
  757. /* sharp.c */    extern pcover cb_dsharp();
  758. /* sharp.c */    extern pcover cb_recur_dsharp();
  759. /* sharp.c */    extern pcover cb_recur_sharp();
  760. /* sharp.c */    extern pcover cb_sharp();
  761. /* sharp.c */    extern pcover cv_dsharp();
  762. /* sharp.c */    extern pcover cv_intersect();
  763. /* sharp.c */    extern pcover cv_sharp();
  764. /* sharp.c */    extern pcover dsharp();
  765. /* sharp.c */    extern pcover make_disjoint();
  766. /* sharp.c */    extern pcover sharp();
  767. /* signature.c */    extern pcover signature();
  768. /* sminterf.c */pset do_sm_minimum_cover();
  769. /* sparse.c */    extern pcover make_sparse();
  770. /* sparse.c */    extern pcover mv_reduce();
  771. /* ucbqsort.c */    //extern qsort();
  772. /* ucbqsort.c */    extern qst();
  773. /* unate.c */    extern pcover find_all_minimal_covers_petrick();
  774. /* unate.c */    extern pcover map_cover_to_unate();
  775. /* unate.c */    extern pcover map_unate_to_cover();
  776. /* unate.c */    extern pset_family exact_minimum_cover();
  777. /* unate.c */    extern pset_family gen_primes();
  778. /* unate.c */    extern pset_family unate_compl();
  779. /* unate.c */    extern pset_family unate_complement();
  780. /* unate.c */    extern pset_family unate_intersect();
  781. /* verify.c */    extern PLA_permute();
  782. /* verify.c */    extern bool PLA_verify();
  783. /* verify.c */    extern bool check_consistency();
  784. /* verify.c */    extern bool verify();
  785.  
  786. int        push_black_list(void);
  787. void    reset_black_list(void);
  788.